<?php include ('includes/header.php');?>
<?php include ('includes/db_connect.php');?>
<?php
    $sql = "SELECT * FROM complaints WHERE id = '".$_GET['id']."'";
    $query = mysql_query($sql);
    $data = mysql_fetch_array($query);

    $sqlCategories = "SELECT * FROM categories";
    $queryCategories = mysql_query($sqlCategories);
?>
            <br>
            <br>
            <br>
            <a href="complaint_print.php?id=<?php echo $data['id']; ?>" target="_blank" class="btn btn-default fa fa-print"></a>
            <a href="complaint_edit.php?id=<?php echo $data['id']; ?>" class="btn btn-default fa fa-edit"></i></a>
            <!-- <a onclick="PrintThis()" class="btn btn-default fa fa-print"></a> -->
            <br>
            <br>
            <div class="row">
                <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
                    <img src="images/btlogo.png" class="img-responsive" alt="Image">
                </div>
                <div class="col-xs-8 col-sm-8 col-md-8 col-lg-8 text-center">
                    <h1 style="font-size:350%;font-family:optimum">Guest Experience <br> Report</h1>
                </div>
                <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
                    <img src="<?php echo file_exists($data['thumb']) ? $data['thumb'] : 'images/guest.png';?>?<?php echo strtotime(date('Y-m-d H:i:s')); ?>" class="img-responsive" alt="Image" style= "padding:1px;border:thin solid black; margin-top:50px">
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <br>
            <div class="row">
                <table class="table table-bordered">
                    <tbody>
                        <tr>
                            <td rowspan="3" class="text-center" style="vertical-align: middle;"> <strong>Date Complaint </strong> <br><?php echo date("M j, Y, H:i", strtotime($data['date_complaint'])) ?></td>
                            <td class="text-center" style="vertical-align: middle;"><b><?php echo $data['guest_name'] ?></b></td>
                            <td class="text-center" style="vertical-align: middle;"><strong>#<?php echo $data['villa_no'] ?></strong></td>
                            <td rowspan="3" class="text-center" style="vertical-align: middle;"><strong>Check-In Date</strong><br><?php echo date("l, M j, Y", strtotime($data['ci_date'])) ?></td>
                            <td rowspan="3" class="text-center" style="vertical-align: middle;"><strong>Check-Out Date:</strong><br><?php echo date("l, M j, Y", strtotime($data['co_date'])) ?></td>
                        </tr>
                        <tr>
                            <td class="text-center"><?php echo $data['nationality'] ?></td>
                            <td rowspan="2" class="text-center" style="vertical-align: middle;"><strong>Source:</strong><br><?php echo $data['source'] ?></td>
                        </tr>
                        <tr>
                            <td class="text-center"><a href="mailto:<?php echo $data['guest_email'] ?>"><?php echo $data['guest_email'] ?></a></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
                    <h2 style="font-family:optimum" class="bg-danger"><?php echo $data['complaint_title'] ?></h2>
                    <h4 class="bg-primary" style="font-family:optimum">DESCRIPTIONS OF COMPLAINT</h4>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <table class="table table-bordered">
                        <tbody>
                            <tr>
                                <td class="text-center" style="font-family:optimum#"><?php echo nl2br($data['description']) ?></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
                    <h4 class="bg-primary" style="font-family:optimum">RECOVERY ACTION</h4>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <table class="table table-bordered">
                        <tbody>
                            <tr>
                                <td class="text-center" style="font-family:optimum#"><?php echo nl2br($data['recovery']) ?></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
                    <h4 class= "text-left" style="font-family:optimum">Further follow up:</h4>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <table class="table table-bordered">
                        <tbody>
                            <tr>
                                <td class="text-centre" style="font-family:optimum#"><?php echo nl2br($data['further_follow_up']) ?></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <dl>
                        <dt>Compensation</dt>
                        <dd><?php echo $data['compensation'] ?></dd>
                        <dt>Cost</dt>
                        <dd>IDR <?php echo number_format($data['price'], 2, '.', ',') ?></dd>
                    </dl>
                </div>
            </div>
            <div class="row text-center">
                <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
                    <strong>Follow Up By:</strong> <?php echo $data['follow_up'] ?>
                </div>
                <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
                    <strong>Created By:</strong> <?php echo $data['created_by'] ?>
                </div>
            </div>
            <!-- /.row -->
<script>
function PrintThis() {
    window.print();
}
</script>

<?php include ('includes/footer.php');?>